package com.train.daily.api;

import com.train.common.resp.CommonResp;
import com.train.daily.dto.ticket.DailyTrainTicketQueryOneDTO;
import com.train.daily.dto.ticket.DailyTrainTicketReduceTicketDTO;
import com.train.daily.resp.ticket.DailyTrainTicketQueryOneResp;
import com.train.daily.service.DailyTrainTicketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class DailyTrainTicketApiImpl implements DailyTrainTicketApi {

    @Autowired
    private DailyTrainTicketService dailyTrainTicketService;

    @Override
    public CommonResp getDailyTrainTicket(DailyTrainTicketQueryOneDTO dto) {
        DailyTrainTicketQueryOneResp dailyTrainTicket = dailyTrainTicketService.getDailyTrainTicket(dto);
        return CommonResp.ok(dailyTrainTicket);
    }

    @Override
    public CommonResp batchReduceDailyTrainTicket(List<DailyTrainTicketReduceTicketDTO> dtoList) {
        dailyTrainTicketService.batchReduceDailyTrainTicket(dtoList);
        return CommonResp.ok();
    }
}
